class Solution {
public:
    vector<string> uncommonFromSentences(string s1, string s2) {
        unordered_map<string, int> map1;
        vector<string> v;

        int first = 0;
        int pos = 0;
        while (pos <= s1.size())
        {
            if (s1[pos] == ' ' || pos == s1.size())
            {
                map1[s1.substr(first, (pos - first))]++;
                first = pos++;
            }
            pos++;
        }

        first = 0;
        pos = 0;
        while (pos <= s2.size())
        {
            if (s2[pos] == ' ' || pos == s2.size())
            {
                map1[s2.substr(first, (pos - first))]++;
                first = pos++;
            }
            pos++;
        }

        auto it = map1.begin();
        while (it != map1.end())
        {
            if (it->second == 1)
            {
                v.push_back(it->first);
            }
            it++;
        }

        return v;
    }
};